<?php

use Illuminate\Support\Facades\Route;
use Modules\Production\Http\Controllers\ProductionOrderController;
use Modules\Production\Http\Controllers\StockTaskController;
use Modules\Production\Http\Controllers\ProductionOrderDetailController;
use Modules\Production\Http\Controllers\StockTaskScanController;
use Modules\Production\Http\Controllers\ProductionReportOrderController;
use Modules\Production\Http\Controllers\ProductionReportDetailController;
use Modules\Production\Http\Controllers\PickOrderController;
use Modules\Production\Http\Controllers\PickOrderDetailController;
use Modules\Production\Http\Controllers\ProductionWareOrderController;
use Modules\Production\Http\Controllers\ProductionWareDetailController;
use Modules\Production\Http\Controllers\MaterialReturnPlanDetailController;
use Modules\Production\Http\Controllers\MaterialReturnPlanOrderController;
use Modules\Production\Http\Controllers\MaterialReturnDetailController;
use Modules\Production\Http\Controllers\MaterialReturnOrderController;
use Modules\Production\Http\Controllers\ProductionProcessController;
use Modules\Production\Http\Controllers\ProductionProcessDetailController;
use Modules\Production\Http\Controllers\ReportOrderBoxController;
use Modules\Production\Http\Controllers\PickOrderDetailSplitController;
use Modules\Production\Http\Controllers\BackReportController;
use Modules\Production\Http\Controllers\DassemblyOrderController;
use Modules\Production\Http\Controllers\DassemblyOrderDetailController;
use Modules\Production\Http\Controllers\DassemblyOrderProductController;

Route::prefix('production')->group(function(){

    //生产工单相关
	Route::apiResource('production/order', ProductionOrderController::class);
	//工艺流程绑定
    Route::post('order/bindflow',[ProductionOrderController::class,'bindProcessFlow']);
    //备货任务人员指派
    Route::post('stocktask/bindOperator',[StockTaskController::class,'bindOperator']);
    //预留查询
    Route::get('kingdee/stock/{docno}/{fnumber}',[StockTaskController::class,'kingdeeStock']);
    //备货扫描
    Route::post('stock/confirm',[StockTaskController::class,'stockConfirm']);
    //备货确认
    Route::post('stock/submit',[StockTaskController::class,'stockSubmit']);
    //生产工单详情
    Route::apiResource('order/detail', ProductionOrderDetailController::class);

    //备货看板详情
    Route::get('back/report',[BackReportController::class,'backDetailList']);
    //自定义工单列表
    Route::get('back/list',[BackReportController::class,'backOrderList']);

    //生产汇报扫描
    Route::get('report/scan', [ProductionReportOrderController::class,'checkProduction']);
    //生产汇报订单
    Route::apiResource('report/order', ProductionReportOrderController::class);
    //生产汇报订单详情
    Route::apiResource('report/detail', ProductionReportDetailController::class);
    //生产汇报箱号
    Route::apiResource('report/box', ReportOrderBoxController::class);
    //生产汇报箱号补打
    Route::post('report/print', [ReportOrderBoxController::class,'printData']);

    //备货扫描明细
    Route::apiResource('stock/task/scan', StockTaskScanController::class);
    //生产入库单
    Route::apiResource('ware/order', ProductionWareOrderController::class);
    //生产入库单子项
    Route::apiResource('ware/detail', ProductionWareDetailController::class);
    //生产入库明细汇总
    Route::get('ware/group/by', [ProductionWareDetailController::class,'listByGroup']);

    //生产领料单
    Route::apiResource('pick/order', PickOrderController::class);
    //生产领料单明细
    Route::apiResource('pick/detail', PickOrderDetailController::class);
    //生产领料单明细汇总
    Route::get('pick/group/by', [PickOrderDetailController::class,'listByGroup']);

    //生产入库箱号查询
    Route::get('ware/lotnum',[ProductionWareOrderController::class,'lotnum']);
    //生产入库提交
    Route::post('ware/submit',[ProductionWareOrderController::class,'submit']);

    /**
     * 生产退料计划相关
     */
    //退料计划订单头
    Route::apiResource('return/plan', MaterialReturnPlanOrderController::class);
    //生产退料计划箱号扫描
    Route::get('return/byplan/scan/by', [MaterialReturnPlanOrderController::class,'scan']);
    Route::apiResource('return/byplan/detail', MaterialReturnPlanDetailController::class);
    //生产退料计划单子项汇总查询
    Route::get('return/byplan/detail/groupby/{orderId}', [MaterialReturnPlanDetailController::class,'groupBy']);
    //根据箱号查询生产领料单信息
    Route::get('pick/lotnum',[PickOrderController::class,'getByLotnum']);
    //根据箱号查询生产退料计划子项明细
    Route::get('return/bylotnum',[MaterialReturnPlanDetailController::class,'getByLotnum']);
    //生产退料修改扫描
    Route::get('return/scan/byupdate',[MaterialReturnPlanDetailController::class,'getReturnPlanByLotnum']);
    Route::post('return/scan/byupdate',[MaterialReturnPlanOrderController::class,'modify']);

    /**
     * 生产退料相关
     */
    //生产退料单据头
    Route::apiResource('return/order', MaterialReturnOrderController::class);
    //生产退料明细
    Route::apiResource('return/detail', MaterialReturnDetailController::class);
    //生产退料明细汇总
    Route::get('return/detail/groupby/{orderId}', [MaterialReturnDetailController::class,'groupBy']);

    /**
     * 工序报工相关
     */
    //工单工艺
    Route::apiResource('process/list', ProductionProcessController::class);
    //工单工艺报工明细
    Route::apiResource('process/detail', ProductionProcessDetailController::class);
    Route::get('process/qrcode',[ProductionProcessDetailController::class,'getByQrcode']);

    /**
     * 组装拆卸相关
     */
    //组装拆卸单据头
    Route::apiResource('dassembly/order', DassemblyOrderController::class);

    //组装拆卸单成品
    Route::apiResource('dassembly/product', DassemblyOrderProductController::class);
    //拆卸成品出库扫描
    Route::get('dassembly/product/out/{productId}',[DassemblyOrderProductController::class,'DassemblyOutScan']);
    //拆卸成品出库提交
    Route::post('dassembly/product/out/{productId}',[DassemblyOrderProductController::class,'DassemblyOut']);

    //组装拆卸单子件
    Route::apiResource('dassembly/detail', DassemblyOrderDetailController::class);

});


















